{tpl head}
<script src="{$skin}style/js/bootstrap.js"></script>

<script src="{$skin}style/time/mobiscroll_002.js" type="text/javascript"></script>
<script src="{$skin}style/time/mobiscroll_004.js" type="text/javascript"></script>
<link href="{$skin}style/time/mobiscroll_002.css" rel="stylesheet" type="text/css">
<link href="{$skin}style/time/mobiscroll.css" rel="stylesheet" type="text/css">
<script src="{$skin}style/time/mobiscroll.js" type="text/javascript"></script>
<script src="{$skin}style/time/mobiscroll_003.js" type="text/javascript"></script>
<script src="{$skin}style/time/mobiscroll_005.js" type="text/javascript"></script>
<link href="{$skin}style/time/mobiscroll_003.css" rel="stylesheet" type="text/css">

<header class="header-fix main-nav bg-black header header-lg navbar navbar-fixed-top-xs box-shadow">
  <div class="container">
    <div class="navbar-header aside-sm"> <a class="btn btn-link visible-xs" href="javascript:history.back()"> <i class="icon iconfont">&#xf007a;</i> </a>
      <div class="navbar-brand">详细信息 </div>
      {if !$tid}
      <a href="?c=device&a=view&id={$id}&o=1" class="rbtn radius btn-warning">原始数据</a>
      {/if}
      <Br>
    {if $new_mod_time}({$new_mod_time}){/if}</div>
  </div>
</header>
<form action="" method="post" id="myform" onsubmit="return send();">
  <input type="hidden" name="id" value="{$id}">
  <input type="hidden" name="tid" value="{$tid}">
<div class="middle-box container text-center loginscreen  animated fadeInDown mt60">
  <div class="m-t">
    <div class="list-group lanmu-list">


      <!--设备状态 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">设备状态：</label>         <div class="iptbg col-xs-8">
          <select size="1" name="n[status_id]" class="form-control no-border" <?php if ($new_mod[status_id] && $new_mod[status_id]!=$oj->status_id ){?> style="color:#ff0000"<?php }?>>
            {loop $list_status $k=>$v}
            <option value="{$k}" <?php if ($new_mod[status_id]){ if($new_mod[status_id]!=$oj->brand_id && $new_mod[status_id]==$v->id){?> selected <?php }}else{?> {if $k==$oj.status_id}selected{/if}<?php }?>>{$v}</option>
            {/loop}
          </select>
          <input type="hidden" name="o[status_id]" value="{$oj.status_id}">
        </div>
      </dd>
      <!--品牌 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">品牌：</label>         <div class="iptbg col-xs-8">
          <select size="1" name="n[brand_id]" class="form-control no-border" <?php if ($new_mod[brand_id] && $new_mod[brand_id]!=$oj->brand_id ){?> style="color:#ff0000"<?php }?>>
            {loop $list_brand $k=>$v}
            <option value="{$v.id}" <?php if ($new_mod[brand_id]){ if($new_mod[brand_id]!=$oj->brand_id && $new_mod[brand_id]==$v->id){?> selected <?php }}else{?>  {if $v.id==$oj.brand_id}selected{/if}<?php }?>>{$v.name}</option>
            {/loop}
          </select>
          <input type="hidden" name="o[brand_id]" value="{$oj.brand_id}">
        </div>
      </dd>

      <!--型号 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">型号：</label>         <div class="iptbg col-xs-8">
          <input type="text" name="n[model]" class="form-control no-border textb" placeholder="{$oj.model}" value="{$new_mod[model]}">
        </div>
      </dd>
      <!--出厂编号 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">出厂编号：</label>         <div class="iptbg col-xs-8">
          <input type="text" name="n[product_no]" class="toup form-control no-border textb" placeholder="{$oj.product_no}" value="{$new_mod[product_no]}">
        </div>
      </dd>
      <!--出厂日期 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">出厂日期：</label>         <div class="iptbg col-xs-8">
          <input type="text" id="appDate" name="n[product_date]" class="form-control no-border textb appDate" placeholder="{if $oj.product_date}{function=date('Y-m-d',$oj.product_date)}{/if}" value="{$new_mod[product_date]}">
        </div>
      </dd>
      <!--存放地点 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">存放地点：</label>         <div class="iptbg col-xs-8">

          <select size="1" name="n[location]" class="form-control no-border" <?php if ($new_mod['location'] && $new_mod['location']!=$oj->location ){?> style="color:#ff0000"<?php }?>>
            {loop $list_loc $k=>$v}
            <option value="{$v.id}" <?php if ($new_mod['location'] ){ if( $new_mod['location']!=$oj->location && $new_mod['location']==$v->id){?> selected <?php }}else{?> {if $v.id==$oj.location}selected{/if}<?php }?>>{$v.name}</option>
            {/loop}
          </select>
        </div>
      </dd>

      <!--领用部门 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">领用部门：</label>         <div class="iptbg col-xs-8">

          <select size="1" name="n[use_department]" class="form-control no-border" <?php if ($new_mod['use_department'] && $new_mod['use_department']!=$oj->use_department ){?> style="color:#ff0000"<?php }?>>
            {loop $list_department $k=>$v}
            <option value="{$v.id}" <?php if ($new_mod['use_department']){ if($new_mod['use_department']!=$oj->brand_id && $new_mod['use_department']==$v->id){?> selected <?php }}else{?>  {if $v.id==$oj.use_department}selected{/if}<?php }?>>{$v.name}</option>
            {/loop}
          </select>
        </div>
      </dd>

      <!--领用人 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">领用人：</label>         <div class="iptbg col-xs-8">
          <input type="text" name="n[use_user_name]" class="form-control no-border textb" placeholder="{$oj.use_user_name}" value="{$new_mod[user_user_name]}">
        </div>
      </dd>
      <!--领用日期 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">领用日期：</label>         <div class="iptbg col-xs-8">
          <input type="text"   name="n[use_date]" class="form-control no-border textb appDate" placeholder="{if $oj.use_date}{function=date('Y-m-d',$oj.use_date)}{/if}" value="{$new_mod[use_date]}">
        </div>
      </dd>

      <!--负责人 start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">负责人：</label>         <div class="iptbg col-xs-8">
          <input type="text" name="n[person]" class="form-control no-border textb" placeholder="{$oj.person}" value="{$new_mod[person]}">
        </div>
      </dd>
      <!--IP start-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">IP：</label>         <div class="iptbg col-xs-8">
          <input type="text" name="n[ip]" class="form-control no-border textb" placeholder="{$oj.ip}" value="{$new_mod[ip]}">
        </div>
      </dd>


      <!--add start-->
      {loop $field $k $v}
      <?php if($k==0)continue;?>
      <!--{$v.Comment} start-->
      <input type="hidden" name="o_addon[{$v.Field}]" value="<?php echo $addon[$v->Field]?>">
      <dd class="list-group-item regitem  <?php if($v->Field=='record_no' || $v->Field=='country_no' ){ }else{?>dn{/if}">
        <label class="col-xs-4 lh56">{$v.Comment}：</label>         <div class="iptbg col-xs-8">
          <?php if( $v->Field=='os'){?>
            <select size="1" name="addon[os]" class="form-control no-border" <?php if ($new_addon['os'] && $new_addon['os']!=$addon['os'] ){?> style="color:#ff0000"<?php }?>>
              {loop $list_os $k=>$sv}
              <option value="{$sv.id}"
                      {if $new_addon['os']}
                  <?php if($new_addon['os']!=$addon['os'] && $new_addon['os']==$sv->id){?> selected
                  <?php }}else{?>  {if $sv.id==$addon['os']}selected{/if}<?php }?>>{$sv.name}</option>
              {/loop}
            </select>
          <?php }elseif($v->Field=='net'){?>
            <select size="1" name="addon[net]" class="form-control no-border" <?php if ($new_addon['net'] && $new_addon['net']!=$addon['net'] ){?> style="color:#ff0000"<?php }?>>
              {loop $list_net $k=>$sv}
              <option value="{$sv.id}"
                  {if $new_addon['net']}
              <?php if($new_addon['net']!=$addon['net'] && $new_addon['net']==$sv->id){?>
                  selected
              {/if}
                <?php
              }else{?>
                {if $sv.id==$addon['net']}selected{/if}<?php }?>>{$sv.name}</option>
              {/loop}
            </select>
          <?php }else{?>

          <input type="text" name="addon[{$v.Field}]" class="{if $v.Field=='mac'}toup {/if}form-control no-border textb" placeholder="<?php
          if($tid){}else{
            if($addon[$v->Field]){ echo $addon[$v->Field];}
          }?>" value="<?php echo $new_addon[$v->Field]?>"
                 {if $v.Field=='mac'}maxlength="12" {/if}>

          {/if}
        </div>
      </dd>
      {/loop}
      <!--add end-->
      <!--备注-->
      <dd class="list-group-item regitem">
        <label class="col-xs-4 lh56">备注：</label>         <div class="iptbg col-xs-8">
          <input type="text" name="n[con]" class="form-control no-border textb" placeholder="{$oj.con}" value="{$new_mod[con]}">
        </div>
      </dd>

      <!--OBJ_ID start-->
      <dd class="list-group-item regitem dn">

        <label class="col-xs-4 lh56">OBJ_ID：</label>
        <div class="iptbg col-xs-8">
          <input type="text" name="n[obj_id]" class="form-control no-border textb" placeholder="{$oj.obj_id}" disabled value="{$new_mod[obj_id]}">
        </div>
      </dd>
      <!--设备名称 start-->
      <dd class="list-group-item regitem dn">
        <label class="col-xs-4 lh56">设备名称：</label>
        <div class="iptbg col-xs-8">
          <input type="text" name="n[name]" class="form-control no-border textb" placeholder="{$oj.name}" value="{$new_mod[name]}">
        </div>
      </dd>
      <!--产权归属 start-->
      <dd class="list-group-item regitem dn">
        <label class="col-xs-4 lh56">产权归属：</label>         <div class="iptbg col-xs-8">
          <select size="1" name="n[cq_id]" class="form-control no-border" <?php if ($new_mod[cq_id] && $new_mod[cq_id]!=$oj->cq_id ){?> style="color:#ff0000"<?php }?>>
            {loop $list_cq $k=>$v}
            <option value="{$v.id}" <?php if ($new_mod[cq_id] ){ if($new_mod[cq_id]!=$oj->brand_id && $new_mod[cq_id]==$v->id){?> selected <?php }}else{?> {if $v.id==$oj.cq_id}selected{/if}<?php }?>>{$v.name}</option>
            {/loop}
          </select>
          <input type="hidden" name="o[cq_id]" value="{$oj.cq_id}">
        </div>
      </dd>
      <!--设备编号 start-->
      <dd class="list-group-item regitem dn">
        <label class="col-xs-4 lh56">设备编号：</label>         <div class="iptbg col-xs-8">
          <input type="text" name="n[device_no]" class="form-control no-border textb" placeholder="{$oj.device_no}" value="{$new_mod[device_no]}">
        </div>
      </dd>
      <!--资产性质 start-->
      <dd class="list-group-item regitem dn">
        <label class="col-xs-4 lh56">资产性质：</label>         <div class="iptbg col-xs-8">
          <select size="1" name="n[zichanxingzhi]" class="form-control no-border" <?php if ($new_mod['zichanxingzhi'] && $new_mod['zichanxingzhi']!=$oj->zichanxingzhi ){?> style="color:#ff0000"<?php }?>>
            {loop $list_xz $k=>$v}
            <option value="{$v.id}" <?php if ($new_mod['zichanxingzhi']){ if($new_mod['zichanxingzhi']!=$oj->brand_id && $new_mod['zichanxingzhi']==$v->id){?> selected <?php }}else{?>  {if $v.id==$oj.zichanxingzhi}selected{/if}<?php }?>>{$v.name}</option>
            {/loop}
          </select>
        </div>
      </dd>



      <a class="listmore"  href="javascript:;">查看更多 ↓</a> </div>
  </div>
</div>
<button type="submit" id="sub" class="foot_btn regsubmit btn btn-lg btn-primary btn-block submit">保存修改</button>
  </form>
<script type="text/javascript">

  function send(){
    $.ajax({
      cache: false,
      type: "POST",
      url:'?c=device&a=view',
      dataType:'json',
      data:$('#myform').serialize(),// 你的formid
      async: false,
      error: function(request) {
        alert("未连接到服务器,提交失败!");
      },
      success: function(data) {
        alert(data.msg);
        if(data.state==1 && data.url){
          window.location=data.url;
        }

      }
    });
    return false;
  }
  $(function () {
    $(":text").focusin(function() {
      if($(this).val()=="") {
        $(this).val($(this).attr("placeholder"));
      }
    });
    $(":text").focusout(function() {
      if($(this).val()==$(this).attr("placeholder")) {
        $(this).val('');
      }
    });
    var currYear = (new Date()).getFullYear();
    var opt={};
    opt.date = {preset : 'date'};
    opt.datetime = {preset : 'datetime'};
    opt.time = {preset : 'time'};
    opt.default = {
      theme: 'android-ics light', //皮肤样式
      display: 'modal', //显示方式
      mode: 'scroller', //日期选择模式
      dateFormat: 'yyyy-mm-dd',
      lang: 'zh',
      showNow: true,
      nowText: "今天",
      startYear: currYear - 10, //开始年份
      endYear: currYear + 10 //结束年份
    };
    $(".appDate").mobiscroll($.extend(opt['date'], opt['default']));
    var optDateTime = $.extend(opt['datetime'], opt['default']);
    var optTime = $.extend(opt['time'], opt['default']);
  });
</script>
</body>
</html>
